Skip to content

Conversation

@sei40kr
Copy link
Contributor

@sei40kr sei40kr commented Jan 29, 2026

Summary

  • Port Ruby's node_ext.rb functionality to Rust bindings
  • Add full_name and full_name_parts methods for ConstantReadNode, ConstantWriteNode, ConstantTargetNode, ConstantPathNode, and ConstantPathTargetNode
  • Add ConstantPathError enum for error handling

Test Coverage

Rust bindings include 11 unit tests compared to Ruby's 8 tests. Additional coverage includes:

  • ConstantWriteNode (not tested in Ruby)
  • ConstantTargetNode (not tested in Ruby)
  • MissingNodes error case (not tested in Ruby)

Public API Changes (cargo-public-api)

Added items to the public API
=============================
+pub enum ruby_prism::ConstantPathError
+pub ruby_prism::ConstantPathError::DynamicParts
+pub ruby_prism::ConstantPathError::MissingNodes
+impl core::clone::Clone for ruby_prism::ConstantPathError
+impl core::cmp::Eq for ruby_prism::ConstantPathError
+impl core::cmp::PartialEq for ruby_prism::ConstantPathError
+impl core::error::Error for ruby_prism::ConstantPathError
+impl core::fmt::Debug for ruby_prism::ConstantPathError
+impl core::fmt::Display for ruby_prism::ConstantPathError
+impl<'pr> ruby_prism::ConstantPathNode<'pr>
+pub fn ruby_prism::ConstantPathNode<'pr>::full_name(&self) -> Result
+pub fn ruby_prism::ConstantPathNode<'pr>::full_name_parts(&self) -> Result>, ConstantPathError>
+impl<'pr> ruby_prism::ConstantPathTargetNode<'pr>
+pub fn ruby_prism::ConstantPathTargetNode<'pr>::full_name(&self) -> Result
+pub fn ruby_prism::ConstantPathTargetNode<'pr>::full_name_parts(&self) -> Result>, ConstantPathError>
+impl<'pr> ruby_prism::ConstantReadNode<'pr>
+pub fn ruby_prism::ConstantReadNode<'pr>::full_name(&self) -> Cow<'pr, str>
+pub fn ruby_prism::ConstantReadNode<'pr>::full_name_parts(&self) -> Vec>
+impl<'pr> ruby_prism::ConstantTargetNode<'pr>
+pub fn ruby_prism::ConstantTargetNode<'pr>::full_name(&self) -> Cow<'pr, str>
+pub fn ruby_prism::ConstantTargetNode<'pr>::full_name_parts(&self) -> Vec>
+impl<'pr> ruby_prism::ConstantWriteNode<'pr>
+pub fn ruby_prism::ConstantWriteNode<'pr>::full_name(&self) -> Cow<'pr, str>
+pub fn ruby_prism::ConstantWriteNode<'pr>::full_name_parts(&self) -> Vec>

Test plan

  • bundle exec rake cargo:test passes
  • bundle exec rake cargo:lint passes
  • Doctests pass

🤖 Generated with Claude Code

@sei40kr sei40kr marked this pull request as draft January 29, 2026 04:41
@sei40kr sei40kr changed the title feat: add node_ext module with full_name methods for constant nodes [rust] add node_ext module with full_name methods for constant nodes Jan 29, 2026
Port Ruby's `node_ext.rb` functionality to Rust bindings, providing
`full_name` and `full_name_parts` methods for `ConstantReadNode`,
`ConstantWriteNode`, `ConstantTargetNode`, `ConstantPathNode`, and
`ConstantPathTargetNode`.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sei40kr sei40kr force-pushed the feat/rust-node-ext branch from ed95c4e to f3f9590 Compare January 29, 2026 05:33
@sei40kr sei40kr marked this pull request as ready for review January 29, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant